﻿#region
/* ===============================================
 * 作者：guopeng           时间：2012/2/2 19:35:26
 * 
 * 
 * 类描述：
 * 
 * 
 * =============================================== */
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using ueEngine.Biz.Inf.Entities.DBSupport;
using ueEngine.Framework.Exception;

namespace ueEngine.Biz.Inf.Entities
{
    /// <summary>
    /// 职位申请单
    /// </summary>
    [Table("RequestSheet")]
    public class RequestSheet : BaseEntity<RequestSheet>
    {
        public RequestSheet() { }
        public override RequestSheet Get(System.Linq.Expressions.Expression<Func<RequestSheet, bool>> where)
        {
            using (Context ctx = new Context())
            {
                var item = ctx.RequestSheet.FirstOrDefault(where);
                if (item != null)
                {
                    this.Id = Id;
                    this.Message = item.Message;
                    this.PositionId = item.PositionId;
                    this.RecruitId = item.RecruitId;
                    this.Period = item.Period;
                    this.State = item.State;
                    this.ResumeId = item.ResumeId;
                    this.Salary = item.Salary;
                    this.UserName = item.UserName;
                    this.SalaryType = item.SalaryType;
                    return this;
                }
                return null;
            }
        }
        #region Fileds
        [Key]
        [Column("Id",TypeName="int")]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        /// <summary>
        /// 申请的招募单Id
        /// </summary>
        [Column("RecruitId",TypeName="int")]
        [Required]
        public int RecruitId { get; set; }

        /// <summary>
        /// 申请的职位Id
        /// </summary>
        [Column("PositionId",TypeName="int")]
        [Required]
        public int PositionId { get; set; }

        /// <summary>
        /// 简历Id.
        /// 会员可以主动维护一份简历，也可以直接投递简历，然后系统会自动生成一份简历
        /// 如果是非登录人员自动生成一份简历
        /// </summary>
        [Column("ResumeId",TypeName="int")]
        public int ResumeId { get; set; }

        /// <summary>
        /// 希望获得报酬（周期与职位薪酬周期相同）
        /// </summary>
        [Column("Salary", TypeName = "decimal")]
        public decimal Salary { get; set; }

        [Column(TypeName = "int")]
        public int Period { get; set; }

        /// <summary>
        /// 申请状态 0：未操作 1：拒绝 2：同意
        /// </summary>
        [Column(TypeName="int")]
        public int State { get; set; }

        /// <summary>
        /// 期望薪酬方式，1：面议 2：范围
        /// </summary>
        [Column(TypeName="int")]
        public int SalaryType { get; set; }
        /// <summary>
        /// 求职标题
        /// </summary>
        [Column(TypeName="nvarchar")]
        [StringLength(200)]
        public string Title { get; set; }

        [Column(TypeName="datetime")]
        public DateTime PostDate { get; set; }
        /// <summary>
        /// 求职短消息
        /// </summary>
        [Column("Message",TypeName="nvarchar")]
        [StringLength(2000)]
        public string Message { get; set; }

        /// <summary>
        /// 用户
        /// </summary>
        [Column("UserName", TypeName = "varchar")]
        [StringLength(200)]
        public string UserName { get; set; }
        #endregion
    }
}
